import request from '@/utils/request'

// 查询角色列表(获取公司拥有角色)
export function fetchRoleList(companyId, roleName) {
  return request({
    url: '/authority/auRole/queryList',
    method: 'get',
    params: { companyId, roleName }
  })
}

// 查询角色详情
export function fetchRoleDetail(roleId) {
  return request({
    url: '/authority/auRole/detail',
    method: 'get',
    params: { roleId }
  })
}

// 删除角色
export function fetchRoleDelete(roleId) {
  return request({
    url: '/authority/auRole/delete',
    method: 'delete',
    params: { roleId }
  })
}

// 添加角色
export function createRoleAdd(data) {
  return request({
    url: '/authority/auRole/add',
    method: 'post',
    data
  })
}

// 修改角色
export function updateRoleArticle(data) {
  return request({
    url: '/authority/auRole/update',
    method: 'put',
    data
  })
}

// 获取角色在系统中的功能权限
export function fetchRoleSysRes(roleId, sysId) {
  return request({
    url: '/authority/auRole/sys/resources',
    method: 'get',
    params: { roleId, sysId }
  })
}

// 获取角色能够使用的系统
export function fetchRoleSystems(roleId) {
  return request({
    url: '/authority/auRole/systems',
    method: 'get',
    params: { roleId }
  })
}

